<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录 - 健身学习平台</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: #333;
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .login-container {
            width: 100%;
            max-width: 450px;
        }

        .login-card {
            background: white;
            border-radius: 15px;
            padding: 40px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            transition: transform 0.3s;
        }

        .login-card:hover {
            transform: translateY(-5px);
        }

        .logo {
            text-align: center;
            margin-bottom: 30px;
        }

        .logo h1 {
            font-size: 32px;
            color: #764ba2;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 10px;
        }

        .logo p {
            color: #666;
            font-size: 16px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: #555;
        }

        .input-with-icon {
            position: relative;
        }

        .input-with-icon i {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: #888;
            font-size: 18px;
        }

        input {
            width: 100%;
            padding: 14px 15px 14px 45px;
            border: 2px solid #e1e1e1;
            border-radius: 8px;
            font-size: 16px;
            transition: all 0.3s;
        }

        input:focus {
            border-color: #764ba2;
            outline: none;
            box-shadow: 0 0 0 3px rgba(118, 75, 162, 0.1);
        }

        .options {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
        }

        .remember-me {
            display: flex;
            align-items: center;
        }

        .remember-me input {
            width: auto;
            margin-right: 8px;
        }

        .forgot-password {
            color: #764ba2;
            text-decoration: none;
            font-size: 14px;
            transition: color 0.3s;
        }

        .forgot-password:hover {
            color: #5a3a7e;
            text-decoration: underline;
        }

        .button-container {
            margin-bottom: 25px;
        }

        button {
            width: 100%;
            padding: 14px;
            background: linear-gradient(135deg, #007bff, #0056b3);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
        }

        button:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
        }

        .divider {
            text-align: center;
            position: relative;
            margin: 25px 0;
            color: #888;
        }

        .divider::before {
            content: "";
            position: absolute;
            top: 50%;
            left: 0;
            right: 0;
            height: 1px;
            background: #e1e1e1;
        }

        .divider span {
            background: white;
            padding: 0 15px;
            position: relative;
        }

        .social-login {
            display: flex;
            justify-content: center;
            gap: 15px;
            margin-bottom: 25px;
        }

        .social-btn {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #f5f5f5;
            border: 1px solid #e1e1e1;
            cursor: pointer;
            transition: all 0.3s;
            font-size: 20px;
        }

        .social-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        }

        .register-link {
            text-align: center;
            color: #666;
        }

        .register-link a {
            color: #764ba2;
            text-decoration: none;
            font-weight: 500;
            transition: color 0.3s;
        }

        .register-link a:hover {
            color: #5a3a7e;
            text-decoration: underline;
        }

        .error-message {
            background: #ffebee;
            color: #c62828;
            padding: 12px;
            border-radius: 6px;
            margin-bottom: 20px;
            border-left: 4px solid #c62828;
        }

        /* 响应式设计 */
        @media (max-width: 480px) {
            .login-card {
                padding: 30px 20px;
            }

            .options {
                flex-direction: column;
                align-items: flex-start;
                gap: 10px;
            }
        }
    </style>
</head>
<body>
<div class="login-container">
    <div class="login-card">
        <div class="logo">
            <h1>💪 健身学习平台</h1>
            <p>登录账户，继续你的健身之旅</p>
        </div>

        <!-- 使用Thymeleaf显示错误信息 -->
        <div th:if="${error}" class="error-message" style="display: block;">
            <strong>登录失败：</strong><span th:text="${error}"></span>
        </div>

        <form action="/auth/login" method="post">
            <div class="form-group">
                <label for="username">用户名或邮箱</label>
                <div class="input-with-icon">
                    <i>👤</i>
                    <input type="text" id="username" name="username" placeholder="请输入用户名或邮箱" required>
                </div>
            </div>

            <div class="form-group">
                <label for="password">密码</label>
                <div class="input-with-icon">
                    <i>🔒</i>
                    <input type="password" id="password" name="password" placeholder="请输入密码" required>
                </div>
            </div>

            <div class="options">
                <div class="remember-me">
                    <input type="checkbox" id="remember" name="remember">
                    <label for="remember">记住我</label>
                </div>
                <a href="#" class="forgot-password">忘记密码？</a>
            </div>

            <div class="button-container">
                <button type="submit">登录</button>
            </div>

            <div class="divider">
                <span>或使用以下方式登录</span>
            </div>

            <div class="social-login">
                <div class="social-btn">微</div>
                <div class="social-btn">Q</div>
                <div class="social-btn">微</div>
            </div>

            <div class="register-link">
                还没有账户？<a href="/auth/register">立即注册</a>
            </div>
        </form>
    </div>
</div>

<script>
  // 音频播放函数
  function playVoiceAudio(type) {
    const audioMap = {
      'login': '/sounds/funny/登录页面欢迎你觉行者请输入账号和密码开启学习征途哦.wav'
    };
    
    const audioPath = audioMap[type];
    if (!audioPath) return;
    
    const audio = new Audio(audioPath);
    audio.play().catch(err => {
      console.error('播放音频失败:', err);
    });
  }
  
  // 页面加载完成后播放欢迎音效
  document.addEventListener('DOMContentLoaded', () => {
    setTimeout(() => {
      playVoiceAudio('login');
    }, 500);
  });
</script>
</body>
</html>